Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add async iterator over bytes in result of get #11

Merged
merged 6 commits into from
Oct 18, 2024
Merged

Conversation

kylebarron
Copy link
Member

@kylebarron kylebarron commented Oct 18, 2024

This is super cool. Really excited to test this tomorrow. Original credit goes to @timteeee in roeap/object-store-python#29

  • Both async and sync iterators over a get result
  • We should be able to do the same for list so that we return an iterator, instead of materializing the entire list result at once.
  • Implementing __iter__ that returns self is something I need to do in arro3; somewhere I have to call iter() manually, or something like that.
  • would also be cool if you could take in an iterator or async iterator for the delete_stream method

Tomorrow I'll add a test for this.

@kylebarron
Copy link
Member Author

import boto3
import object_store_rs as obs

store = obs.store.S3Store.from_session(boto3.Session(), "ookla-open-data")
path = "parquet/performance/type=mobile/year=2023/quarter=3/2023-07-01_performance_mobile_tiles.parquet"

resp = obs.get(store, path)
async for buf in aiter(resp):
    print(len(buf))

that's super cool

@kylebarron kylebarron merged commit c10f3fe into main Oct 18, 2024
4 checks passed
@kylebarron kylebarron deleted the kyle/bytes-stream branch October 18, 2024 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant